package com.campus.service.impl;

import com.campus.entity.TManagerClass;
import com.campus.entity.TManagerStudent;
import com.campus.mapper.ClassMapper;
import com.campus.service.IClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ClassServiceImpl implements IClassService {

    @Autowired
    private ClassMapper classMapper;
    @Override
    public int createClass(Integer id, String name, String classDesc, Integer teacherId, Integer activityId) {

        TManagerClass tManagerClass = new TManagerClass();
        tManagerClass.setId(id);
        tManagerClass.setName(name);
        tManagerClass.setClassDesc(classDesc);
        tManagerClass.setTeacherId(teacherId);
        tManagerClass.setActivityId(activityId);
        return classMapper.createClass(tManagerClass);
    }

    @Override
    public int updateClass(Integer id, String name, String classDesc, Integer teacherId, Integer activityId) {
        return classMapper.updateClass(id, name, classDesc, teacherId, activityId);
    }

    @Override
    public int createStudent(Integer id, String stuName, String fromPlace, String parentPhone, String currentGrade, Integer loginId, Integer classId) {
        TManagerStudent tManagerStudent = new TManagerStudent();
        tManagerStudent.setCurrentGrade(currentGrade);
        tManagerStudent.setFromPlace(fromPlace);
        tManagerStudent.setId(id);
        tManagerStudent.setLoginId(loginId);
        tManagerStudent.setStuName(stuName);
        tManagerStudent.setClassId(classId);
        tManagerStudent.setParentPhone(parentPhone);

        return classMapper.createStudent(tManagerStudent);
    }
}
